<html>
	<head>
		<meta content="text/html; charset=UTF-8" http-equiv="content-type">
		<title><{$smarty.const._LB_TET_TET_TET}></title>
		<script src="js/jquery-latest.js"></script>
		<script src="js/jquery.form.js"></script>
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<!--[if IE]>
		<link rel="stylesheet" type="text/css" href="css/fix_ie.css" />
		<![endif]-->
	</head>
	<body>
		<!--[if lt IE 7]>
		<div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;'>
		<div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice'/></a></div>
		<div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
		  <div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
		  <div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
			<div style='font-size: 14px; font-weight: bold; margin-top: 12px;'><?php echo '_LB_IE6_ALERT_1'; ?></div>
			<div style='font-size: 12px; margin-top: 6px; line-height: 12px;'><?php echo '_LB_IE6_ALERT_2'; ?></div>
		  </div>
		  <div style='width: 75px; float: left;'><a href='http://www.firefox.com' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg' style='border: none;' alt='Get Firefox 3.5'/></a></div>
		  <div style='width: 75px; float: left;'><a href='http://www.browserforthebetter.com/download.html' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg' style='border: none;' alt='Get Internet Explorer 8'/></a></div>
		  <div style='width: 73px; float: left;'><a href='http://www.apple.com/safari/download/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg' style='border: none;' alt='Get Safari 4'/></a></div>
		  <div style='float: left;'><a href='http://www.google.com/chrome' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg' style='border: none;' alt='Get Google Chrome'/></a></div>
		</div>
		</div>
		<![endif]-->
		<div class="container">
			<div class="top-bar">
				<div id="game-logo" >
					<img src="images/<{$smarty.const._LB_TET_TET_TET_LOGO}>" alt="<{$smarty.const._LB_TET_TET_TET}>" />
				</div>
				<div id="login-box" class="login-box">
					<{include file='loginbox.tpl'}>
				</div>
			</div>
			<div class="main">
				<div class="box">
					<h3 id="title"></h3>
					<div id="message" style="text-align:center;vertical-align:middle;"></div>
					<div id="content" class="content">
						<div id="game-screen">
							<h3 id="game-content" style="color: blue;">...</h3>
						</div>
						<ul id="options-list">
							<li name="answer"><a href="javascript:void(0);"></a></li>
							<li name="answer"><a href="javascript:void(0);"></a></li>
							<li name="answer"><a href="javascript:void(0);"></a></li>
							<li name="answer"><a href="javascript:void(0);"></a></li>
						</ul>
						<ul class="items">
							<li id="personal-score"></li>
							<li id="credit"></li>
							<li id="back-button" class="right"><a href="javascript:void(0);"></a></li>
							<li id="next-button" class="right"><a href="javascript:void(0);"></a></li>
						</ul>
							
					</div>
				</div>
				<div class="box game-logo-list">
					<ul>
						<li><a href="getthepicture.php"><img src="images/select-getthepicture.png" alt="<{$smarty.const._LB_GET_THE_PICTURE}>" /></a></li>
						<li><a href="culturalmosaic.php"><img src="images/select-culturalmosaic.png" alt="<{$smarty.const._LB_CULTURAL_MOSAIC}>" /></a></li>
						<li><a href="tettettet.php"><img src="images/select-tettettet.png" alt="<{$smarty.const._LB_TET_TET_TET}>" /></a></li>
						<li><a href="http://www.tuoitrenews.vn/cmlink/tuoitrenews/game/who-s-who-writing-contest-1.58636"><img src="images/select-who.png" alt="<{$smarty.const._LB_CONTEST_WHO}>" /></a></li>
					</ul>
				</div>
			</div>
			<div class="side">
				<div class="adv">
					<a href="http://www.eximbank.com.vn/vn/" target="_blank" ><img src="images/EXIMBANK.jpg" /></a>
				</div>

				<div class="box metal">
					<h3><{$smarty.const._LB_CONTEST_NEWS}></h3>
					<div class="content">
						<ul style="list-style:none;text-align:left;">
							<li><a style="font-size:16px;" href="http://www.tuoitrenews.vn/cmlink/tuoitrenews/game/tuoitrenews-launches-get-the-picture-contest-1.58715" target="_blank"><{$smarty.const._LB_CONTEST_RULES}></a></li>
							<li><a style="font-size:16px;" href="http://www.tuoitrenews.vn/cmlink/tuoitrenews/game/who-s-who-writing-contest-1.58636" target="_blank"><{$smarty.const._LB_CONTEST_WHO}></a></li>
							<li><a style="font-size:16px;" href="http://tuoitrenews.vn/cmlink/tuoitrenews/lifestyle/tuoi-tre-initiates-traditional-tet-program-1.57815" target="_blank"><{$smarty.const._LB_ONLINE_TET}></a></li>
						</ul>
					</div>
				</div>

				<div class="box pink">
					<{include file='latest_players.tpl'}>
				</div>
				
					<script type="text/javascript">
						var int = self.setInterval("loadTopPlayers()",10000);
						$(document).ready(function(){
							$("li[name=answer]").each(function(index) {
								$(this).children(":first").click(function (){
									var obj_li = $(this).parent();
									$.ajax({
									  url: "tettettet.php?act=20&index=" + (index + 1),
									  success: function(data){
									  	  var obj = jQuery.parseJSON( data );
										  $("li[name=answer]").each(function() {
											  $(this).attr("class","");
											});
											obj_li.attr("class","selected");
											$("#credit").text(obj.remaining + " <{$smarty.const._LB_PHOTO_LEFT}>");
											
											if(obj.is_last == 1)
											{
												fill(obj);
											}
									  }
									});
								});
							});
							

						});
						sendRequest("tettettet.php?act=0");
						function sendRequest(url)
						{
							$("#game-picture").attr("src", "images/ajax-loader.gif");
							$("#game-picture").attr("width", "");
							$.getJSON(url,
							function(data) {
								fill(data);
							});
						}
						
						function loadTopPlayers()
						{
							$.getJSON("gettopplayers.php?gametype=3",
							function(data) {
								fillTopPlayers(data);
							});
						}
						
						function fillTopPlayers(data)
						{
							if(data.players)
							{
								var table	= $("#top-players").children("table");
								table.html("");
								$.each(data.players, function(index){
									var tr		= $("<tr/>");
									var td_id	= $("<td/>").attr("class", "id");
									var td_name = $("<td/>").attr("class", "name");
									var td_mark = $("<td/>").attr("class", "mark");
									td_id.text(data.players[index].id + ". ");
									td_id.appendTo(tr);
									td_name.text(data.players[index].name);
									td_name.appendTo(tr);
									td_mark.text(data.players[index].date);
									td_mark.appendTo(tr);
									tr.appendTo(table);
								});
							}
						}

						function fill(data)
						{
							if(data.end)
							{
								$("#title").html(data.title);
								$("#message").html(data.message);
								$("#content").html("");
								fillTopPlayers(data);
										
							}
							else
							{
								$("#title").text("<{$smarty.const._LB_QUESTION_NO}> " + data.current);
								$("#game-content").text(data.question.text);
								$("li[name=answer]").each(function(index) {
									var index_ext = index + 1;
									$(this).children(":first").text(index_ext + ". " + data.question.answers[index_ext].text);
									$(this).attr("class", data.question.answers[index_ext].selected);
								});

								//$("#personal-score").text(data.score + " <{$smarty.const._LB_POINT}>");
								$("#credit").text(data.remaining + " <{$smarty.const._LB_PHOTO_LEFT}>");
								if(data.back != "")
								{
									$("#back-button").children(":first").show();
									$("#back-button").children(":first").text(data.back);
									$("#back-button").children(":first").attr("href", "javascript:void(0);");
									$("#back-button").children(":first").attr("onclick", "sendRequest('" + data.back_link + "');");
								}
								else
								{
									$("#back-button").children(":first").hide();
								}
								
								$("#next-button").children(":first").show();
								$("#next-button").children(":first").text(data.forward);
								$("#next-button").children(":first").attr("href", "javascript:void(0);");
								$("#next-button").children(":first").attr("onclick", "sendRequest('" + data.forward_link + "');");
								
								if(data.is_last == 1)
								{
									if(data.remaining >0)
									{
										$("#next-button").children(":first").hide();
									}	
								}
							}
						}
					</script>
				<div class="clear"></div>
			</div>
			<div class="footer">
				<a href="http://www.eximbank.com.vn/vn/" target="_blank" ><img src="images/Eximbank-Ad.gif" width="934" height="123" /></a>
			</div>
			<div class="clear"></div>
		</div>
	</body>
</html>
